{
 "metadata": {
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.9.0-final"
  },
  "orig_nbformat": 2,
  "kernelspec": {
   "name": "python37764bit5d211478a4cf4a3d93a2c891f6a9207d",
   "display_name": "Python 3.7.7 64-bit"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2,
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [],
   "source": [
    "'''\n",
    "创建 6.fibo.ipynb 文件，必须和 fibo.py 文件在同一个目录。\n",
    "否则在外部调用时会因为路径问题报错，这个坑要看完后面的才会明白。\n",
    "'''\n",
    "import fibo"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {
    "tags": []
   },
   "outputs": [
    {
     "output_type": "stream",
     "name": "stdout",
     "text": [
      "0 1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 \n"
     ]
    }
   ],
   "source": [
    "'''\n",
    "进入fibo并不能直接调用，而是需要用 fibo.fib 的形式调用。\n",
    "'''\n",
    "\n",
    "fibo.fib(1000)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [
    {
     "output_type": "execute_result",
     "data": {
      "text/plain": [
       "[0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89]"
      ]
     },
     "metadata": {},
     "execution_count": 5
    }
   ],
   "source": [
    "fibo.fib2(100)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {
    "tags": []
   },
   "outputs": [
    {
     "output_type": "stream",
     "name": "stdout",
     "text": [
      "0 1 1 2 3 5 8 13 21 34 55 89 144 233 377 \n"
     ]
    }
   ],
   "source": [
    "fib =fibo.fib # 直接赋值给局部变量，可简化\n",
    "fib(500)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [
    {
     "output_type": "execute_result",
     "data": {
      "text/plain": [
       "'fibo'"
      ]
     },
     "metadata": {},
     "execution_count": 8
    }
   ],
   "source": [
    "fibo.__name__"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [
    {
     "output_type": "execute_result",
     "data": {
      "text/plain": [
       "['e:\\\\Code\\\\python教程官方文档\\\\6.模块',\n",
       " 'C:\\\\ProgramData\\\\Anaconda3\\\\python37.zip',\n",
       " 'C:\\\\ProgramData\\\\Anaconda3\\\\DLLs',\n",
       " 'C:\\\\ProgramData\\\\Anaconda3\\\\lib',\n",
       " 'C:\\\\ProgramData\\\\Anaconda3',\n",
       " '',\n",
       " 'C:\\\\Users\\\\watalo\\\\AppData\\\\Roaming\\\\Python\\\\Python37\\\\site-packages',\n",
       " 'C:\\\\Users\\\\watalo\\\\AppData\\\\Roaming\\\\Python\\\\Python37\\\\site-packages\\\\win32',\n",
       " 'C:\\\\Users\\\\watalo\\\\AppData\\\\Roaming\\\\Python\\\\Python37\\\\site-packages\\\\win32\\\\lib',\n",
       " 'C:\\\\Users\\\\watalo\\\\AppData\\\\Roaming\\\\Python\\\\Python37\\\\site-packages\\\\Pythonwin',\n",
       " 'C:\\\\ProgramData\\\\Anaconda3\\\\lib\\\\site-packages',\n",
       " 'C:\\\\ProgramData\\\\Anaconda3\\\\lib\\\\site-packages\\\\win32',\n",
       " 'C:\\\\ProgramData\\\\Anaconda3\\\\lib\\\\site-packages\\\\win32\\\\lib',\n",
       " 'C:\\\\ProgramData\\\\Anaconda3\\\\lib\\\\site-packages\\\\Pythonwin',\n",
       " 'C:\\\\Users\\\\watalo\\\\AppData\\\\Roaming\\\\Python\\\\Python37\\\\site-packages\\\\IPython\\\\extensions',\n",
       " 'C:\\\\Users\\\\watalo\\\\.ipython']"
      ]
     },
     "metadata": {},
     "execution_count": 9
    }
   ],
   "source": [
    "import sys\n",
    "sys.path"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ]
}